/* 地图页面专用样式 */

/* 主要布局 */
.dashboard-main {
    margin-top: 70px; /* 为固定导航栏留出空间 */
    min-height: calc(100vh - 70px);
}

/* 面板标题 */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-header h1 i {
    margin-right: 1rem;
}

.dashboard-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 统计面板 */
.stats-panel {
    padding: 2rem 0;
    background: var(--bg-gray);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.healthy {
    background: linear-gradient(45deg, #10b981, #059669);
}

.stat-icon.warning {
    background: linear-gradient(45deg, #f59e0b, #d97706);
}

.stat-icon.danger {
    background: linear-gradient(45deg, #ef4444, #dc2626);
}

.stat-icon.total {
    background: linear-gradient(45deg, var(--primary-color), #1d4ed8);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.2rem;
}

.stat-content p {
    color: var(--text-gray);
    font-weight: 500;
}

/* 地图区域 */
.map-section {
    padding: 3rem 0;
    background: white;
}

.map-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* 控制面板 */
.control-panel {
    background: var(--bg-gray);
    padding: 2rem;
    border-radius: 12px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.control-panel h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group {
    margin-bottom: 2rem;
}

.filter-group label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 2px solid #ddd;
    position: relative;
    transition: all 0.3s ease;
}

.checkmark.healthy {
    border-color: #10b981;
}

.checkmark.warning {
    border-color: #f59e0b;
}

.checkmark.danger {
    border-color: #ef4444;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: currentColor;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark.healthy {
    background: #10b981;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark.warning {
    background: #f59e0b;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark.danger {
    background: #ef4444;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.filter-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.btn-primary, .btn-secondary {
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 图例 */
.legend {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.legend h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-color.healthy {
    background: #10b981;
}

.legend-color.warning {
    background: #f59e0b;
}

.legend-color.danger {
    background: #ef4444;
}

/* 地图显示区域 */
.map-display {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.china-map {
    width: 100%;
    height: 600px;
    background: #f8fafc;
}

/* 地图工具栏 */
.map-toolbar {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.tool-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.tool-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* 详细信息面板 */
.details-panel {
    padding: 3rem 0;
    background: var(--bg-gray);
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.detail-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 养殖场详情 */
.farm-details .no-selection {
    color: var(--text-gray);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.farm-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-label {
    font-weight: 500;
    color: var(--text-gray);
}

.info-value {
    font-weight: 600;
    color: var(--text-dark);
}

/* 检测记录 */
.test-records {
    max-height: 300px;
    overflow-y: auto;
}

.record-item {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.record-item:last-child {
    border-bottom: none;
}

.record-date {
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: 500;
}

.record-type {
    font-weight: 500;
    color: var(--text-dark);
}

.record-result {
    text-align: center;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.record-result.healthy {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.record-result.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.record-result.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* 趋势图表 */
.trend-chart {
    height: 300px;
    width: 100%;
}

/* 实时警报面板 */
.alert-panel {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-height: 400px;
    overflow: hidden;
}

.alert-panel.show {
    transform: translateX(0);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-gray);
}

.alert-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-alert {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-alert:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.alert-content {
    max-height: 340px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
    color: white;
}

.alert-item.danger .alert-icon {
    background: #ef4444;
}

.alert-item.warning .alert-icon {
    background: #f59e0b;
}

.alert-info {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

.alert-message {
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .map-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .control-panel {
        position: static;
        order: 2;
    }
    
    .map-display {
        order: 1;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .alert-panel {
        width: 300px;
        right: 10px;
    }
}

@media (max-width: 768px) {
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .china-map {
        height: 400px;
    }
    
    .farm-info {
        grid-template-columns: 1fr;
    }
    
    .record-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: left;
    }
    
    .record-result {
        text-align: left;
        width: fit-content;
    }
    
    .alert-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .control-panel {
        padding: 1.5rem;
    }
    
    .detail-card {
        padding: 1.5rem;
    }
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* 活动状态指示器 */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.healthy {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.status-indicator.warning {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

.status-indicator.danger {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
    animation: pulse 1s infinite;
}
